(define-module (gwwm color)
  #:use-module (gwwm utils)
  #:use-module (gwwm i18n)
  #:use-module (srfi srfi-26)
  #:use-module (ice-9 match)
  #:use-module (ice-9 format)
  #:use-module (oop goops)
  #:use-module (util572 color)
  #:use-module (system foreign)
  #:export (make-color color->pointer))

(define make-color make-rgba-color)
(define-method (color->pointer (color <rgba-color>))
  (make-c-struct
   (list float float float float)
   (map (cut / <> 255)
        (color->list color))))

(define-method (color->pointer (color <integer>))
  (color->pointer (make-color color)))
(define-method (color->pointer (color <string>))
  (color->pointer (make-color color)))
